package io.bdmc.modules.bss.service.impl;

import io.bdmc.common.utils.MyPage;
import io.bdmc.modules.bss.entity.DeviceAlarmLevel;
import io.bdmc.modules.bss.mapper.DeviceAlarmLevelMapper;
import io.bdmc.modules.bss.service.IDeviceAlarmLevelService;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 报警等级 服务实现类
 * </p>
 *
 * @author 黄露
 * @since 2021-05-14
 */
@Service
public class DeviceAlarmLevelServiceImpl extends ServiceImpl<DeviceAlarmLevelMapper, DeviceAlarmLevel>
        implements IDeviceAlarmLevelService {
    @Autowired
    DeviceAlarmLevelMapper _devicealarmlevelMapper;

    @Override
    public MyPage<DeviceAlarmLevel> mySelectPage(MyPage<DeviceAlarmLevel> myPage) {
        return _devicealarmlevelMapper.mySelectPage(myPage);
    }

    @Override
    public DeviceAlarmLevel getByAlarmLevelCode(String alarmLevelCode) {

        return _devicealarmlevelMapper
                .selectOne(new QueryWrapper<DeviceAlarmLevel>().eq("alarm_level_code", alarmLevelCode).last("limit 1"));
    }
}
